Private lBackColorFixed As Long, lForeColorFixed As Long, lBackColorBkg As Long
'Private lBackColorSel As Long, lForeColorSel As Long
Private bAllowSelection As Boolean, iFixedStyle As Integer, iSelectionMode As Integer
Private fFont As StdFont, fFontFixed As StdFont, sFormatString As String
Private bAllowUserResizing As Boolean
Private lCurrentRowSizer As Long
Private lCurrentColSizer As Long
Private Cells As clsCellArray
Private lRowHeight() As Integer
Private lColWidth() As Integer, lColAlign() As Integer, bColEdit() As Boolean
Private lColMask() As Integer
Private hSizers As Collection
Private vSizers As Collection
Private lLeftCol As Long
Private lTopRow As Long
'Private Type RECT
' Left As Long
' Top As Long
' Right As Long
' Bottom As Long
'End Type
'Private Type POINTAPI
' x As Long
' y As Long
'End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Boolean
Private Declare Function SetCursorPos Lib "user32" (ByVal lX As Long, ByVal lY As Long) As Boolean
Private Declare Function InvertRect Lib "user32" (ByVal hDC As Long, lpRect As RECT) As Long
Private Declare Function FrameRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal lpPoint As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function ScrollDC Lib "user32" (ByVal hDC As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
'kdq090498 added to show focus rectangle instead of black invert
Private Declare Function DrawFocusRect Lib "user32" (ByVal hDC As Long, lpRect As RECT) As Long
If bGridSolid = False Then picGrid.DrawStyle = 2 'dotted
GetCellCoordinates StartRow, StartCol, x1&, y1&
x1& = x1&
y1& = y1&
GetCellCoordinates EndRow, EndCol, x2&, Y2&
x2& = x2&
Y2& = Y2&
lpRect.Top = y1&
lpRect.Bottom = Y2& + lRowHeight(EndRow)
'X& = X1& + lColWidth(StartCol)
If bRowHeader Then
x& = lColWidth(0) + bytGridLine
Else
x& = 0
End If
For lThisCol = StartCol To EndCol
x& = x& + lColWidth(lThisCol) + bytGridLine
If x& > lScaleWidth Then Exit For
lpRect.Left = x&
lpRect.Right = x&
DrawLine lpRect, lGridLineColor
Next
If bColHeader Then
y& = lRowHeight(0) + bytGridLine
Else
y& = 0
End If
lpRect.Left = x1&
lpRect.Right = x2& + lColWidth(EndCol)
'Y& = Y1& + lRowHeight(StartRow)
For lThisRow = StartRow To EndRow
y& = y& + lRowHeight(lThisRow) + bytGridLine
If y& > lScaleHeight Then Exit For
lpRect.Top = y&
lpRect.Bottom = y&
DrawLine lpRect, lGridLineColor
Next
picGrid.DrawStyle = 0 'Solid
End If
'Draw the right, bottom and the grey box at the bottom right
'DrawBottomRight
DrawGridBorder StartRow, StartCol, EndRow, EndCol
'Draw the blank grey box at the end of the scroll bars
If (bWidthOverflow And bHeightOverflow) Or (scrHorizontal.Visible And scrVertical.Visible) Then DrawBox lScaleWidth - 20, lScaleHeight - 20, 20, 20, COLOR_GREY
End Sub
'Public Sub SetRowHeight(lThisRow&, lNewHeight&)
' lRowHeight(lThisRow&) = lNewHeight&
' RedrawAllCells True
'End Sub
Public Property Get Row() As Long
Attribute Row.VB_Description = "Sets/gets the current row"
Attribute Row.VB_MemberFlags = "400"
Row = lRow
End Property
Public Property Let Row(lNewValue As Long)
HilightCell lRow, lCol
lRow = lNewValue
HilightCell
End Property
Public Property Get Col() As Long
Attribute Col.VB_Description = "Gets/sets the current column number"
Attribute Col.VB_MemberFlags = "400"
Col = lCol
End Property
Public Property Let Col(lNewValue As Long)
HilightCell lRow, lCol
lCol = lNewValue
HilightCell
End Property
Public Property Get Text() As String
Attribute Text.VB_Description = "Gets/sets the text for the current row and column"
Attribute Text.VB_MemberFlags = "400"
Text = Cells.Text(lCol, lRow)
End Property
Public Property Let Text(sNewValue As String)
Cells.Text(lCol, lRow) = sNewValue
End Property
Public Property Get TextMatrix(vRow As Long, vCol As Long) As String
Attribute TextMatrix.VB_Description = "Gets/sets the text for the specified row and column"
TextMatrix = Cells.Text(vCol, vRow)
End Property
Public Property Let TextMatrix(vRow As Long, vCol As Long, sNewValue As String)
Cells.Text(vCol, vRow) = sNewValue
End Property
Public Property Get Redraw() As Boolean
Redraw = bRedraw
End Property
Public Property Let Redraw(bNewValue As Boolean)
bRedraw = bNewValue
Refresh
End Property
Private Sub DrawRightCols(lThisLeftCol As Long, lUpdateWidth As Long)
Dim lScaleWidth As Long, lScaleHeight As Long
Dim lMyColWidth As Long
lScaleWidth = picGrid.ScaleWidth
lScaleHeight = picGrid.ScaleHeight
If bShowGrid Then
bytGridLine = 1
Else
bytGridLine = 0
End If
'If scrVertical.Visible Then
' lScrollWidth = scrVertical.Width
'Else
lScrollWidth = 0
'End If
If bRowHeader Then
x& = lColWidth(0) + 1 + bytGridLine
Else
x& = 1
End If
For l& = lThisLeftCol To lCols
lMyColWidth = lColWidth(l&)
If x& < lScaleWidth - lUpdateWidth - lMyColWidth - lScrollWidth Then
Public Sub MouseMove(button As Integer, Shift As Integer, x As Single, y As Single)
Attribute MouseMove.VB_MemberFlags = "40"
Dim lpRect As RECT, bytPointer As Byte
Dim lScaleWidth As Integer, lScaleHeight As Integer
Dim bShouldRedraw As Boolean, lNewCol2 As Long, lNewRow2 As Long
Dim lPt As POINTAPI
lScaleWidth = picGrid.ScaleWidth
lScaleHeight = picGrid.ScaleHeight
lNewRow2 = RowFromPoint(x, y)
lNewCol2 = ColFromPoint(x, y)
If bSizingCol Then
If scrVertical.Visible Then
lRightEdge = scrVertical.Left - 1
Else
lRightEdge = lScaleWidth
End If
If x <= lRightEdge Then picSizer.Left = x
ElseIf bSizingRow Then
If scrHorizontal.Visible Then
lBottomEdge = scrHorizontal.Top - 1
Else
lBottomEdge = lScaleHeight
End If
If y <= lBottomEdge Then picSizer.Top = y
ElseIf bMouseDown And bAllowSelection And iSelectionMode = 0 Then
If bSelectingRows = True Or bSelectingCols = True Then
'Select more rows
Else
'See if they're selecting multiple cells
'picGrid.AutoRedraw = True
bRedraw = False
bShouldRedraw = False
bMouseHit = False
'See if we need to auto scroll up
If y < 0 Or lNewRow2 = 0 Then
If scrVertical.Value > 1 Then scrVertical = scrVertical - 1
lNewRow2 = lTopRow
bShouldRedraw = True
bMouseHit = True
End If
'See if we need to auto scroll left
If x < 0 Or lNewCol2 = 0 Then
If scrHorizontal.Value > 1 Then scrHorizontal = scrHorizontal - 1
lNewCol2 = lLeftCol
bShouldRedraw = True
bMouseHit = True
End If
'See if we need to auto scroll right
If lNewCol2 < 0 Then lNewCol2 = 0
If x > lScaleWidth Then
If scrHorizontal.Value < scrHorizontal.Max Then
scrHorizontal.Value = scrHorizontal.Value + 1
bShouldRedraw = True
End If
bMouseHit = True
End If
'See if we need to auto scroll down
If lNewRow2 < 0 Then lNewRow2 = 0
If y > lScaleHeight Then
If scrVertical.Value < scrVertical.Max Then
scrVertical.Value = scrVertical.Value + 1
bShouldRedraw = True
End If
bMouseHit = True
End If
'Now find out if we need to hilight the selection
If lNewRow2 = lRow2 And lNewCol2 = lCol2 Then
'do nothing
Else
'Un-hilight the old selection
HilightSelection lRow1, lCol1, lRow2, lCol2
'Hilight the new selection
lRow2 = lNewRow2
lCol2 = lNewCol2
HilightSelection lRow1, lCol1, lRow2, lCol2
bShouldRedraw = True
End If
bRedraw = True
If bShouldRedraw Then picGrid.Refresh
'picGrid.AutoRedraw = False
If bMouseHit Then
GetCursorPos lPt
SetCursorPos lPt.x, lPt.y
End If
End If
Else
If bColHeader = True And lNewRow2 = 0 Then
'If the X is within one of the sizers, change the mouse pointer to a sizer
lCurrentColSizer& = -1
For lCount& = 1 To hSizers.Count
If Abs(hSizers(lCount&) - x) < 2 Then
'It's within 2 pixels of a sizer, so set the MousePointer
lCurrentColSizer& = lCount&
Exit For
End If
Next
If lCurrentColSizer& > -1 Then
UserControl.MousePointer = vbSizeWE
Else
UserControl.MousePointer = vbDefault
End If
' ElseIf bRowHeader = True And lNewCol2 = 0 Then
' 'If the Y is within one of the sizers, change the mouse pointer to a sizer
' lCurrentRowSizer& = -1
' For lCount& = 1 To vSizers.Count
' If Abs(vSizers(lCount&) - y) < 2 Then
' 'It's within 2 pixels of a sizer, so set the MousePointer
' lCurrentRowSizer& = lCount&
' Exit For
' End If
' Next
'
' If lCurrentRowSizer& > -1 Then
' UserControl.MousePointer = vbSizeNS
' Else
' UserControl.MousePointer = vbDefault
' End If
Else
UserControl.MousePointer = vbDefault
End If
End If
MouseMoveExit:
End Sub
Public Sub HilightSelection(Optional Row1, Optional Col1, Optional Row2, Optional Col2)
Attribute HilightSelection.VB_MemberFlags = "40"
Dim lpRect As RECT
Dim lThisRow As Long, lThisCol As Long
Dim lMyRowHeight As Long, lMyColWidth As Long
Dim x1 As Long, y1 As Long, lCol1Width As Long, lRow1Height As Long
Dim x2 As Long, Y2 As Long
'picGrid.AutoRedraw = True
If IsMissing(Row1) Then Row1 = lRow1
If IsMissing(Col1) Then Col1 = lCol1
If IsMissing(Row2) Then Row2 = lRow2
If IsMissing(Col2) Then Col2 = lCol2
If lRows < 1 Or lCols < 1 Then Exit Sub 'kdq090298
If Row1 < lTopRow And Row2 < lTopRow Then Exit Sub
If Col1 < lLeftCol And Col2 < lLeftCol Then Exit Sub
bOver = GetCellCoordinates(Row1, Col1, x1&, y1&)
bOver = GetCellCoordinates(Row2, Col2, x2&, Y2&)
If Col2 < Col1 Then
lpRect.Left = x2
lpRect.Right = x1 + lColWidth(Col1)
If Col2 > lLeftCol Then lpRect.Left = lpRect.Left - 2
Else
lpRect.Left = x1
lpRect.Right = x2 + lColWidth(Col2)
If Col1 > lLeftCol Then lpRect.Left = lpRect.Left - 2
End If
If Row2 < Row1 Then
lpRect.Top = Y2
lpRect.Bottom = y1 + lRowHeight(Row1)
If Row2 > lTopRow Then lpRect.Top = lpRect.Top - 2
Else
lpRect.Top = y1
lpRect.Bottom = Y2 + lRowHeight(Row2)
If Row1 > lTopRow Then lpRect.Top = lpRect.Top - 2
End If
If bShowGrid Then
lpRect.Right = lpRect.Right + 2
lpRect.Bottom = lpRect.Bottom + 2
End If
'Invert the hilighted rect
InvertRect picGrid.hDC, lpRect
'Fix any hilighting of the bottom and right stuff
'DrawBottomRight
'Draw the blank grey box at the end of the scroll bars
If (bWidthOverflow And bHeightOverflow) Or (scrHorizontal.Visible And scrVertical.Visible) Then DrawBox lScaleWidth - 20, lScaleHeight - 20, 20, 20, COLOR_GREY
If bRedraw Then picGrid.Refresh
'picGrid.AutoRedraw = False
End Sub
Private Function GetCellCoordinates(ThisRow, ThisCol, x As Long, y As Long) As Boolean
Dim lScaleWidth As Long, lScaleHeight As Long
Dim lMyColWidth As Long, lMyRowHeight As Long
lScaleWidth = picGrid.ScaleWidth
lScaleHeight = picGrid.ScaleHeight
'Assume it's not on the screen
If bColHeader Then
y& = lRowHeight(0) + bytGridLine + 1
Else
y& = 1
End If
If bRowHeader Then
x& = lColWidth(0) + bytGridLine + 1
Else
x& = 1
End If
' 'See if the current cell is possibly visible
' If ThisRow >= lTopRow And ThisCol >= lLeftCol Then
If bShowGrid Then
bytGridLine = 1
Else
bytGridLine = 0
End If
'Now see if the selected row is on the screen
bRowOver = False
For lCurRow& = lTopRow& To ThisRow
If y& > lScaleHeight - 1 Then
bRowOver = True
Exit For
End If
If lCurRow& < ThisRow Then y& = y& + lRowHeight(lCurRow&) + bytGridLine
Next
'If Not bOver Then
'Now find out if the selected col is on the screen
bColOver = False
For lCurCol& = lLeftCol& To ThisCol
If x& > lScaleWidth - 1 Then
bColOver = True
Exit For
End If
If lCurCol& < ThisCol Then x& = x& + lColWidth(lCurCol&) + bytGridLine
Attribute AllowSelection.VB_Description = "Determines if user can select multiple cells"
AllowSelection = bAllowSelection
End Property
Property Let AllowSelection(bNewVal As Boolean)
bAllowSelection = bNewVal
PropertyChanged "AllowSelection"
End Property
Public Property Get BackColor() As OLE_COLOR
Attribute BackColor.VB_Description = "Sets/gets background color of the grid"
BackColor = lBackColor
End Property
Public Property Let BackColor(ByVal lNewValue As OLE_COLOR)
lBackColor = lNewValue
InitializeRows lRows
Refresh
PropertyChanged "BackColor"
End Property
Public Property Get BackColorFixed() As OLE_COLOR
Attribute BackColorFixed.VB_Description = "Sets/gets the background color of the row and column headers"
BackColorFixed = lBackColorFixed
End Property
Public Property Let BackColorFixed(ByVal lNewValue As OLE_COLOR)
lBackColorFixed = lNewValue
Refresh
PropertyChanged "BackColorFixed"
End Property
Public Property Get ForeColor() As OLE_COLOR
Attribute ForeColor.VB_Description = "Gets/sets foreground color used for text in grid"
ForeColor = lForeColor
End Property
Public Property Let ForeColor(ByVal lNewValue As OLE_COLOR)
lForeColor = lNewValue
PropertyChanged "ForeColor"
End Property
Public Property Get ForeColorFixed() As OLE_COLOR
Attribute ForeColorFixed.VB_Description = "Gets/sets color used in text for row and column headers"
ForeColorFixed = lForeColorFixed
End Property
Public Property Let ForeColorFixed(ByVal lNewValue As OLE_COLOR)
lForeColorFixed = lNewValue
Refresh
PropertyChanged "ForeColorFixed"
End Property
Public Property Get FixedStyle() As FixedStyles
Attribute FixedStyle.VB_Description = "Determines style of row and column headers"
FixedStyle = iFixedStyle
End Property
Public Property Let FixedStyle(ByVal iNew_Value As FixedStyles)
If Not (iFixedStyle = iNew_Value) Then
iFixedStyle = iNew_Value
Refresh
PropertyChanged "FixedStyle"
End If
End Property
Public Property Get SelectionMode() As SelectModes
SelectionMode = iSelectionMode
End Property
Public Property Let SelectionMode(ByVal iNew_Value As SelectModes)
iSelectionMode = iNew_Value
PropertyChanged "SelectionMode"
End Property
Public Property Get Enabled() As Boolean
Enabled = UserControl.Enabled
End Property
Property Let Enabled(bNewVal As Boolean)
UserControl.Enabled = bNewVal
PropertyChanged "Enabled"
End Property
Public Property Get Font() As Font
Attribute Font.VB_Description = "Gets/sets font used for text in grid"
Set Font = fFont
End Property
Property Set Font(New_Font As Font)
Set fFont = New_Font
Refresh
PropertyChanged "Font"
End Property
Public Property Get FontFixed() As Font
Attribute FontFixed.VB_Description = "Gets/sets font used in text for row and column headers"
Set FontFixed = fFontFixed
End Property
Property Set FontFixed(New_Font As Font)
Set fFontFixed = New_Font
Refresh
PropertyChanged "FontFixed"
End Property
Sub ShowAbout()
Attribute ShowAbout.VB_Description = "Show the about box"
Attribute ShowAbout.VB_UserMemId = -552
frmAbout.Show vbModal
End Sub
Public Property Get BackColorBkg() As OLE_COLOR
Attribute BackColorBkg.VB_Description = "Sets/gets the background color of the usercontrol (behind the grid)"
BackColorBkg = lBackColorBkg
End Property
Public Property Let BackColorBkg(ByVal lNewValue As OLE_COLOR)
lBackColorBkg = lNewValue
Refresh
PropertyChanged "BackColorBkg"
End Property
Public Property Get AllowUserResizing() As Boolean
Attribute AllowUserResizing.VB_Description = "Determines if user can resize columns"
AllowUserResizing = bAllowUserResizing
End Property
Property Let AllowUserResizing(bNewVal As Boolean)
bAllowUserResizing = bNewVal
PropertyChanged "AllowUserResizing"
End Property
Public Property Get FormatString() As String
Attribute FormatString.VB_Description = "Sets a format string that sets up a the control's column widths, alignments, and fixed row and column text\r\n"
FormatString = sFormatString
End Property
Property Let FormatString(sNewVal As String)
Dim cnt As Long
sFormatString = sNewVal
ClearAllLookups
UpdateHeader
Refresh
PropertyChanged "FormatString"
End Property
Private Sub UpdateHeader()
Dim ColCnt As Long, Char As String, CharStr As String, cnt As Long
Dim AlignStr As String, lAlign As Long, RowText As Boolean, RowCnt As Long
RowText = False
ColCnt = 1: RowCnt = 1
CharStr = ""
For cnt = 1 To Len(sFormatString)
Char = Mid(sFormatString, cnt, 1)
If Char = "|" Or Char = ";" Then
If CharStr > "" And Not RowText Then
If ColCnt > Cols Then Cols = ColCnt
AlignStr = ""
If InStr("<^>", Left(CharStr, 1)) Then
AlignStr = Left(CharStr, 1)
CharStr = Right(CharStr, Len(CharStr) - 1)
End If
Select Case AlignStr
Case "<"
lAlign = ALIGN_LEFT
Case "^"
lAlign = ALIGN_CENTER
Case ">"
lAlign = ALIGN_RIGHT
Case Else
lAlign = ALIGN_LEFT
End Select
lColAlign(ColCnt) = lAlign
lColWidth(ColCnt) = TextWidth(CharStr) + 5
Cells.Text(ColCnt, 0) = RTrim(CharStr)
ColCnt = ColCnt + 1
ElseIf CharStr > "" And RowText Then
ColCnt = 0
If RowCnt > Rows Then Rows = RowCnt
If lColWidth(ColCnt) < TextWidth(CharStr) + 5 Then
lColWidth(ColCnt) = TextWidth(CharStr) + 5
End If
Cells.Text(ColCnt, RowCnt) = RTrim(CharStr)
RowCnt = RowCnt + 1
Else
Cells.Text(ColCnt, 0) = ""
lColWidth(ColCnt) = 64
ColCnt = ColCnt + 1
End If
CharStr = ""
If Char = ";" Then RowText = True
Else
CharStr = CharStr + Char
End If
Next
If CharStr > "" And Not RowText Then
If ColCnt > Cols Then Cols = ColCnt
AlignStr = ""
If InStr("<^>", Left(CharStr, 1)) Then
AlignStr = Left(CharStr, 1)
CharStr = Right(CharStr, Len(CharStr) - 1)
End If
Select Case AlignStr
Case "<"
lAlign = ALIGN_LEFT
Case "^"
lAlign = ALIGN_CENTER
Case ">"
lAlign = ALIGN_RIGHT
Case Else
lAlign = ALIGN_LEFT
End Select
lColAlign(ColCnt) = lAlign
lColWidth(ColCnt) = TextWidth(CharStr) + 5
Cells.Text(ColCnt, 0) = RTrim(CharStr)
ColCnt = ColCnt + 1
If ColCnt + 1 <= Cols Then
For cnt = ColCnt + 1 To Cols
Cells.Text(cnt, 0) = ""
lColWidth(cnt) = 64
Next
End If
ElseIf CharStr > "" And RowText Then
ColCnt = 0
If RowCnt > Rows Then Rows = RowCnt
If lColWidth(ColCnt) < TextWidth(CharStr) + 5 Then
lColWidth(ColCnt) = TextWidth(CharStr) + 5
End If
Cells.Text(ColCnt, RowCnt) = RTrim(CharStr)
If RowCnt + 1 <= Rows Then
For cnt = RowCnt + 1 To Rows
Cells.Text(0, Rows) = ""
lColWidth(0) = 64
Next
End If
End If
End Sub
Public Sub AutoSetup(NRows As Variant, NCols As Variant, vRowHeader As Boolean, vColHeader As Boolean, vFormatString As Variant)
Attribute AutoSetup.VB_Description = "Automatically setup the grid by passing rows, cols, and a format string"
Dim cnt As Integer
' Always (re)set to zero to avoid errors when fixedrows >= rows
Attribute AutoNewRow.VB_Description = "Determines if editing a cell on the last row automatically creates a new row"
AutoNewRow = bAutoNewRow
End Property
Public Property Let AutoNewRow(ByVal New_Value As Boolean)
bAutoNewRow = New_Value
PropertyChanged "AutoNewRow"
End Property
Public Function RowEmpty(ByVal iRow As Long)
Attribute RowEmpty.VB_Description = "Used to determine if a row is empty, meaning it contains no text in any of the columns for that row. Returns a boolean expression\r\n"
Dim a As Long
Dim bRowEmpty As Boolean
bRowEmpty = True
For a = 1 To lCols
If Len(Trim(TextMatrix(iRow, a))) > 0 Then
bRowEmpty = False
Exit For
End If
Next
RowEmpty = bRowEmpty
End Function
Private Sub ShowLookup()
Dim x As Long, y As Long
GetCellCoordinates lRow, lCol, x, y
If ColHasLookup(lCol) And lCol > 0 And lRow > 0 And lLeftCol <= lCol And lTopRow <= lRow And y + RowHeight(lRow) <= scrHorizontal.Top Then
'GetCellCoordinates lRow, lCol, x, y
cmdLookup.Move x + ColWidth(lCol) - cmdLookup.Width + 1, y + 3, cmdLookup.Width, RowHeight(lRow) - 2
cmdLookup.Visible = True
Else
cmdLookup.Visible = False
End If
End Sub
Public Sub AddLookup(iCol As Integer, Value As String)
Attribute AddLookup.VB_Description = "Add lookup list item for a specific column"
Dim Item As New clsLookup
Item.Column = iCol
Item.Value = Value
LookupValues.Add Item
End Sub
Public Sub RemoveLookup(iCol As Integer, Value As String)
Attribute RemoveLookup.VB_Description = "Remove a specific lookup list item for a column"
Dim cnt As Integer
For cnt = 1 To LookupValues.Count
If LookupValues(cnt).Value = Value And LookupValues(cnt).Column = iCol Then
LookupValues.Remove cnt
Exit For
End If
Next
End Sub
Public Sub ClearLookup(iCol As Integer)
Attribute ClearLookup.VB_Description = "Remove lookup items for a specific column"
Dim cnt As Integer
For cnt = 1 To LookupValues.Count
If LookupValues(cnt).Column = iCol Then
LookupValues.Remove cnt
cnt = 1
End If
Next
End Sub
Public Sub ClearAllLookups()
Attribute ClearAllLookups.VB_Description = "Remove all lookup items for all columns"
Do Until LookupValues.Count = 0
LookupValues.Remove 1
Loop
End Sub
Public Function ColHasLookup(ByVal iCol As Integer) As Boolean
Attribute ColHasLookup.VB_Description = "Gets a value to determine if a column has lookup items"
Dim cnt As Integer
For cnt = 1 To LookupValues.Count
If LookupValues(cnt).Column = iCol Then
ColHasLookup = True
Exit Function
End If
Next
ColHasLookup = False
End Function
Private Sub FillCombo(iCol As Integer)
Dim cnt As Integer
List1.Clear
For cnt = 1 To LookupValues.Count
If LookupValues(cnt).Column = iCol Then
List1.AddItem LookupValues(cnt).Value
End If
Next
End Sub
Public Property Get ListBoxRows() As Integer
Attribute ListBoxRows.VB_Description = "Returns or sets the default number of items to display in the dropdown listbox when a column has a dropdown"
ListBoxRows = m_ListBoxRows
End Property
Public Property Let ListBoxRows(ByVal New_ListBoxRows As Integer)
m_ListBoxRows = New_ListBoxRows
PropertyChanged "ListBoxRows"
End Property
Public Property Get ColAllowEdit(ByVal iCol As Long) As Boolean
Attribute ColAllowEdit.VB_Description = "Determines if a column will allow editing"
ColAllowEdit = bColEdit(iCol)
End Property
Public Property Let ColAllowEdit(ByVal iCol As Long, ByVal Value As Boolean)
bColEdit(iCol) = Value
PropertyChanged "ColAllowEdit"
End Property
Public Property Get ColMask(ByVal iCol As Long) As Integer
Attribute ColMask.VB_Description = "Gets/sets a value to determine what kind of mask will be used for a column"
ColMask = lColMask(iCol)
End Property
Public Property Let ColMask(ByVal iCol As Long, ByVal Value As Integer)